<!--授予角色权限-->
<template>
  <div class="wrapper-container">
    <div class="table-container">
      <el-table
        max-height="600"
        :data="tableData"
        border
        style="width: 100%"
        class="table-data"
        row-class-name="row-class"
        cell-class-name="cell-class"
        header-row-class-name="header-row-class"
        header-cell-class-name="header-cell-class"
      >
        <el-table-column prop="permission" label="权限" align="center">
        </el-table-column>
        <el-table-column prop="system" label="系" align="center">
          <template slot-scope="scope">
            <SelectItem
              v-if="!yesOrNotFlag"
              :name="''"
              :value="scope.row.system"
              @change="
                (e) => {
                  scope.row.system = e;
                }
              "
              :xqList="systemList"
            ></SelectItem>
            <span v-else>{{ scope.row.system }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="role" label="被授予角色" align="center">
          <template slot-scope="scope">
            <SelectItem
              v-if="!yesOrNotFlag"
              :name="''"
              :value="scope.row.role"
              @change="
                (e) => {
                  scope.row.role = e;
                }
              "
              :xqList="roleList"
            ></SelectItem>
            <span v-else>{{ scope.row.role }}</span>
          </template>
        </el-table-column>

        <el-table-column prop="people" label="被授予人" align="center">
          <template v-if="!yesOrNotFlag" slot="header">
            <SelectItem
              :name="''"
              :value="peopleText"
              @change="
                (e) => {
                  peopleText = e;
                }
              "
              :xqList="peopleList"
            ></SelectItem>
          </template>
        </el-table-column>

        <el-table-column v-if="yesOrNotFlag" label="操作" align="center">
          <ButtonItem
            style="margin: 0 auto"
            @click=""
            :name="'删除'"
            :link="''"
            :icon="''"
            :buttonColor="'red'"
          ></ButtonItem>
        </el-table-column>
      </el-table>
    </div>

    <div
      v-if="!yesOrNotFlag"
      class="search-container"
      style="display: flex; justify-content: center !important"
    >
      <ButtonItem
        :name="'授权'"
        :link="''"
        :icon="''"
        @click="givPer"
        :buttonColor="'yellow'"
      ></ButtonItem>
    </div>
  </div>

</template>

<script>
import SelectItem from "../../../components/SelectItem.vue";
import InputItem from "../../../components/InputItem.vue";
import ButtonItem from "../../../components/ButtonItem.vue";
export default {
  components: {
    SelectItem,
    InputItem,
    ButtonItem,
  },
  data() {
    return {
      yesOrNotFlag: false,
      radio4: "授予角色权限",
      xq: "2020春",
      xqList: [
        {
          value: "2020春",
          label: "2020春",
        },
        {
          value: "2020夏",
          label: "2020夏",
        },
      ],
      systemList: [
        {
          value: "系1",
          label: "系1",
        },
        {
          value: "系2",
          label: "系2",
        },
        {
          value: "系3",
          label: "系3",
        },
      ],
      roleList: [
        {
          value: "教研室主任",
          label: "教研室主任",
        },
        {
          value: "队长",
          label: "队长",
        },
        {
          value: "大队长",
          label: "大队长",
        },
        {
          value: "系领导",
          label: "系领导",
        },
        {
          value: "教科处领导",
          label: "教科处领导",
        },
        {
          value: "管理员",
          label: "管理员",
        },
        {
          value: "无",
          label: "无",
        },
      ],
      teacherName: "",
      peopleList: [],
      peopleText: "被授予人",
      tableData: [
        {
          permission: "专业课",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "通识课",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员",
        },
      ],
    };
  },
  methods: {
    givPer() {
      this.yesOrNotFlag = true;
    },
  },
  mounted() {
    if (this.$route.query.yesOrNotFlag) {
      this.yesOrNotFlag = true;
    }
  },
};
</script>
<style lang="less" scoped>
.search-container {
  justify-content: flex-start !important;
}

.search-button {
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 27px;
  background: #f1f8fe;
  border: 1px solid #51aef6;
  border-radius: 6px;

  > span {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #51aef6;
  }

  > img {
    width: 19px;
    height: 19px;
    margin-right: 4px;
  }
}

.table-container {
  margin-top: 30px;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;

    > div {
      margin-bottom: 8px;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/special.less";
.table-container::v-deep .el-table__header th {
  border-color: #c7d7eb !important;
  padding-left: 10px;
}
.filter-button::v-deep .el-radio-button .el-radio-button__inner {
  border-radius: 6px !important;
  border: 1px solid #02c86c;
  color: #02c86c;
  background-color: #dfffef;
}
.filter-button::v-deep
.el-radio-button__orig-radio:checked
+ .el-radio-button__inner {
  border: 1px solid #02c86c;
  color: white;
  background-color: #02c86c;
}
.wrapper-container {
  width: 1711px;
  margin: 0 auto;
}
.table-container {
  margin-top: 30px;

  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}

.save-button {
  width: 87px;
  height: 36px;
  line-height: 36px;
  background: #fff6ef;
  border: 1px solid #f3b815;
  border-radius: 6px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #f3b815;
  text-align: center;
  margin: 82px auto;
}

.zuoyou {
  width: 200px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
</style>
